package com.music.music.service.impl;

import java.util.Collections;
import java.util.List;

import com.music.music.vo.MusicVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.music.music.mapper.CollectMapper;
import com.music.music.domain.Collect;
import com.music.music.service.CollectService;

import javax.annotation.Resource;

/**
 * 用户收藏Service业务层处理
 *
 * @author ruoyi
 * @date 2024-10-22
 */
@Service
public class CollectServiceImpl implements CollectService {
    @Resource
    private CollectMapper collectMapper;

    /**
     * 查询用户收藏
     *
     * @param collectUserId 用户收藏主键
     * @return 用户收藏
     */
    @Override
    public Collect selectCollectByCollectUserId(Long collectUserId) {
        return collectMapper.selectCollectByCollectUserId(collectUserId);
    }

    /**
     * 查询用户收藏列表
     *
     * @param collect 用户收藏
     * @return 用户收藏
     */
    @Override
    public List<Collect> selectCollectList(Collect collect) {
        return collectMapper.selectCollectList(collect);
    }

    @Override
    public List<MusicVo> selectCollectListVo(Collect collect) {
        return collectMapper.selectCollectListVo(collect);
    }

    /**
     * 新增用户收藏
     *
     * @param collect 用户收藏
     * @return 结果
     */
    @Override
    public int insertCollect(Collect collect) {
        return collectMapper.insertCollect(collect);
    }

    /**
     * 修改用户收藏
     *
     * @param collect 用户收藏
     * @return 结果
     */
    @Override
    public int updateCollect(Collect collect) {
        return collectMapper.updateCollect(collect);
    }

    /**
     * 批量删除用户收藏
     *
     * @param collectUserIds 需要删除的用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteCollectByCollectUserIds(Long[] collectUserIds) {
        return collectMapper.deleteCollectByCollectUserIds(collectUserIds);
    }

    /**
     * 删除用户收藏信息
     *
     * @param collectUserId 用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteCollectByCollectUserId(Long collectUserId) {
        return collectMapper.deleteCollectByCollectUserId(collectUserId);
    }

    @Override
    public int deleteCollectByCollectMusicIds(Long userId, Long[] collectMusicIds) {
        return collectMapper.deleteCollectByCollectMusicIds(userId, collectMusicIds);
    }
}
